package com.monboo.album.view
{
	/**
	 * @author robin for Tudou AlbumPlayer 2010-03-26
	 * @AlbumInfoMediator albumInfo
	 * @email:rman@live.cn
	 * @blog:www.xncat.com
	 */
	
	import com.monboo.album.model.AlbumProxy;
	
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class AlbumInfoMediator extends Mediator
	{
		public static const NAME:String = "AlbumInfoMediator"; 

		public var sourceWidth:Number;
		public var sourceHeight:Number;
		
		public var albumWidth:Number;
		public var albumHeight:Number;
		public var imageWidth:Number;
		public var imageHeight:Number;
		
		public var imageY:Number;
		public var imageX:Number;
		
		public var albumTextX:Number;
		public var albumTextY:Number;
		
		public var autoState:Boolean = true;
		public var autoPlay:Boolean;
		public var autoTime:Number;
		public var gotoStop:Boolean;
		public var scaleIn:Boolean;
		public var text:String;
		
		private var _current:Number=0;
		private var _total:Number;
		private var _title:String;
		private var _rollState:Boolean;
		
		private var albumProxy:AlbumProxy;
		private var viewObj:AlbumLite;
		private var albumData:Object;
		
		
		public function AlbumInfoMediator(obj:Object)
		{
			super(NAME,obj);
			viewObj = obj as AlbumLite;

			initProperty();
			
			albumProxy = facade.retrieveProxy(AlbumProxy.NAME) as AlbumProxy;
			albumData = albumProxy.getData();
			_total = albumData.imgUrlArr.length-1;
			_title = albumData.albumName;
		}
		private function initProperty():void{
			sourceWidth = viewObj.sourceWidth;
			sourceHeight = viewObj.sourceHeight;
			
			albumWidth = viewObj.albumWidth;
			albumHeight = viewObj.albumHeight;
			imageWidth = viewObj.imageWidth;
			imageHeight = viewObj.imageHeight;
			
			imageY = viewObj.imageY;
			imageX = viewObj.imageX;
			
			albumTextX = viewObj.albumTextX;
			albumTextY = viewObj.albumTextY;
			
			autoTime = viewObj.autoTime;
			autoPlay = viewObj.autoPlay;
			gotoStop = viewObj.gotoStop;
			scaleIn = viewObj.scaleIn;
		}
		
		public function checkRollPage():Boolean{
			if(_total<7){
				_rollState = false;
			}else{
				_rollState = true;
			}
			return _rollState;
		}
		
		
		public function get title():String{
			return _title;
		}
		public function get total():int{	
			return _total;
		}
		
		public function set current(n:int):void{	
			_current = n;
		}
		public function get current():int{		
			return _current;
		}
		
	}
}